// 引入 Count  的UI组件
import CountUI from '../../components/Count'

// 引入action
import {createIncrementAction , createDecrementAction, createIncrementAsyncAction} from '../../redux/count_action'

// 引入connect 用于连接UI组件与react
import { connect } from 'react-redux'
// import store from '../../redux/store'

// 对象
// state == store.getState == 99
function mapStateToProps(state) {

  return {count: state}
}

// 方法
function mapDispatchToProps(dispatch) {
  return {
    jia: number => dispatch(createIncrementAction(number)),
    jian: number => dispatch(createDecrementAction(number)),
    jiaAsync: (number, timer)=> dispatch(createIncrementAsyncAction(number, timer))
}
}

export default connect(mapStateToProps, mapDispatchToProps)(CountUI)